<?php

declare(strict_types=1);

namespace app\common\model;

class Learn extends Base
{

    protected $name = 'learn';

    public function getCateTextAttr($value, $data)
    {
        $info = VideoCate::find($data['cate_id']);
        return !empty($info)?self::getVideoList($data['cate_id']):'';
    }
    /**
     * 获取视频类型
     */
    public static function getVideoList($value, $type = 1)
    {
        $list = VideoCate::column('title', 'id');
        return $type == 1 ? $list[$value] : $list;
    }
}
